package net.sureon.web.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sureon.app.UserSession;
import net.sureon.biz.DailyTimingMgr;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * 
 * @author Administrator
 * 
 */
public class DeleteDailyTiming implements Controller {

	private DailyTimingMgr dailyTimingMgr;

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		long companyID = ((net.sureon.app.UserSession) request.getSession()
				.getAttribute(UserSession.HTTP_SESSION_KEY)).getCompanyID();

		long dailyTimingID = Long.parseLong(request
				.getParameter("dailyTimingID"));

		dailyTimingMgr.deleteDailyTiming(companyID, dailyTimingID);

		response.sendRedirect(request.getContextPath()
				+ "/user/myDailyTiming.do");
		return null;
	}

	public DailyTimingMgr getDailyTimingMgr() {
		return dailyTimingMgr;
	}

	public void setDailyTimingMgr(DailyTimingMgr dailyTimingMgr) {
		this.dailyTimingMgr = dailyTimingMgr;
	}
}
